<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function max1(a, b) {
        var result = a > b ? a : b;
        return result;
      }
      console.info(max1(1, 2));//求两个数中的最大值

      function max2(a, b) {
        var result = a > b ? a : b;
        console.info(result);
        return; //结束函数的调用
        console.log("111111");//不会再进行输出
      }
      max2(1, 2);

      //IIFE
      var max3 = (function (a, b) {
        var result = a > b ? a : b;
        //console.info(result);
        return result; //结束函数的调用
      })(1, 2);
      console.log(max3);
    </script>
  </body>
</html>
